﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Maps.aspx.cs"   Inherits="AbcFastFix2010.Maps.Maps" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Your Data on Google Map </title>
    <%--Google API reference--%>
    <script type="text/javascript"
      src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <style type="text/css">
        .auto-style1
        {
            width: 447px;
        }
        
        .style1
        {
            width: 1048px;
        }
        
    </style>
    <script language="JavaScript" type="text/javascript">
<!--
        function Tog(x) {
            var expandable = document.getElementById('column2');
            expandable.style.display = x;
            if (column1.style.width == "100%") {
                column1.style.width = "80%";
            }
            else {
                column1.style.width = "100%";
            }
        }
    // -->
    </script>

</head>

<body >
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
    
    <asp:Table ID="Table1" runat="server" Width="100%">
    
         <asp:TableRow>  
         <asp:TableCell Width="10%"> 
            <asp:TextBox ID="txtStartDate"  runat="server"> </asp:TextBox>
            <asp:RequiredFieldValidator runat="server" ID="SDateReq"  
                ControlToValidate="txtStartDate"  
                Display="None"  
                ErrorMessage="<b>Required Field Missing</b><br />A start date is required." />  

            <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDate"></asp:CalendarExtender>
            <asp:ValidatorCalloutExtender runat="Server" ID="NReqE"  
                TargetControlID="SDateReq"  
                HighlightCssClass="validatorCalloutHighlight" />  

        </asp:TableCell>
         <asp:TableCell Width="20%"> <asp:Image ID="Image1" runat="server" ImageUrl="~/icons/yellow01.png"/> Show WO On Site Parts Received 
          <asp:CheckBox ID="chkBoxWOONsitePartsReceived"  Checked="true" runat="server" /></asp:TableCell>
         <asp:TableCell Width="3%">Tech<asp:DropDownList ID="DropDownTechs" runat="server"></asp:DropDownList> </asp:TableCell>
         <asp:TableCell    VerticalAlign="Top" RowSpan="3">
         List of Those address not found by geocoding, seek administration help <br />
         <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
         </asp:TableCell>
     </asp:TableRow>
         <asp:TableRow>
            <asp:TableCell>  <asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox> 
             <asp:RequiredFieldValidator runat="server" ID="EDateReq"  
                ControlToValidate="txtEndDate"  
                Display="None"  
                ErrorMessage="<b>Required Field Missing</b><br />A End date is required." />  
              <asp:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1"  
                TargetControlID="EDateReq"  
                HighlightCssClass="validatorCalloutHighlight" />  

              <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtEndDate"></asp:CalendarExtender>
                
            </asp:TableCell> 
             <asp:TableCell>
                    <asp:Image ID="Image2"  runat="server" ImageUrl="~/icons/green01.png" />  Show Units Requiring More Info     
                       <asp:CheckBox ID="chkboxUnitsRequiringMoreInfo" Checked="true" runat="server" /> 
             </asp:TableCell>
             <asp:TableCell>
                Department<asp:DropDownList ID="departmentsDropDown" runat="server"></asp:DropDownList>
             </asp:TableCell>
             <asp:TableCell>
             </asp:TableCell>
         </asp:TableRow>
         <asp:TableRow>
                <asp:TableCell>
                         <%-- Show WO Trips  <asp:CheckBox ID="chkboxTrips" runat="server" Checked="true" />        --%>  
                </asp:TableCell>     

                <asp:TableCell>
                   <asp:Image ID="Image3" runat="server" ImageUrl="~/icons/purple01.png" /> Show Parts In 7 or Less Days 
                     <asp:CheckBox ID="chkboxpartsIn7OrLessDays"  Checked="true" runat="server" />
                </asp:TableCell>
                <asp:TableCell>
                   Category<asp:DropDownList ID="categoriesDropDown" runat="server"></asp:DropDownList>
                </asp:TableCell>
                <asp:TableCell> </asp:TableCell>
         
            </asp:TableRow>
         <asp:TableRow>
             <asp:TableCell >
                  Show Dealer Pickups <asp:CheckBox ID="chkboxDealers" runat="server" Checked="true"  />
            </asp:TableCell>
               <asp:TableCell> 
                   <asp:Button runat="server" ID="btnBuildTripMap" Text="Build Trip Map" OnClick="BuildTripMap_Click" />
               </asp:TableCell>
               <asp:TableCell>
                 <asp:Button runat="server" ID="btnBuildGoogleDirectionMap" Text="Get Directions" OnClick="BuildTripDirections_Click" />
               </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    <asp:Literal ID="js" runat="server"></asp:Literal>  
   
    <table style="width: 100%;">
       <tr>  
        <td id="column1" style="width: 100%;">           
        <asp:TabContainer ID="TabContainer2" runat="server"  UseVerticalStripPlacement="false" VerticalStripWidth="120px">
       <!-- Tab that contains the google maps. -->
        <asp:TabPanel ID="TabPanel4" runat="server" 
        HeaderText="Map"
        Enabled="true"
        ScrollBars="Auto"        
        OnDemandMode="Once">
        <ContentTemplate>
                    <div id="map_canvas"                 
                        style="width: 100%; height: 981px; ">
                    </div>
        </ContentTemplate>
       </asp:TabPanel>
        <!-- That that contains the calendar of scheduled Trips -->
        <asp:TabPanel ID="TabPanel5" runat="server" 
        HeaderText="Calendar"
        Enabled="true"
        ScrollBars="Auto"        
        OnDemandMode="Once">
      
        <ContentTemplate>
                    <daypilot:daypilotcalendar 
                     id="DayPilotCalendar1" 
                     runat="server" 
                     DataStartField="eventstart" 
                     DataEndField="eventend"
                     DataTextField="name" 
                     DataValueField="id" 
                     Days="7" 
                    
                     EventMoveHandling="CallBack"
                     >
                    </daypilot:daypilotcalendar>
                  
                    <asp:Repeater ID="JobSizeRepeater" runat="server">
                    <HeaderTemplate>
                    <table class="tblcolor"  bgcolor="silver"  border="1">
                    <tr>
                        <td>Trip Day </td>
                        <td>Total Job Size </td>
                    </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                      <tr>
                        
                        <td> <%# DataBinder.Eval(Container.DataItem, "TripDate")%></td>
                        <td> <%# DataBinder.Eval(Container.DataItem, "JobSize")%></td>
                      </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                     </table>
                    </FooterTemplate>
                   
                    </asp:Repeater>
        </ContentTemplate>


       </asp:TabPanel>         
       <!-- Tab that contains Received Parts List-->     
        <asp:TabPanel ID="tabPanelReceivedParts" runat="server" 
        HeaderText="On Site Parts Received"
        Enabled="true"
        ScrollBars="Auto"        
        OnDemandMode="Once"    
         >
        <ContentTemplate>
             <asp:GridView ID="gridViewReceivedParts" runat="server" AutoGenerateColumns="false"
              CellPadding="4" ForeColor="Black" BackColor="Aqua" GridLines="Horizontal" >
              <Columns>
                  <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Bind("invoice") + Request.QueryString("invoice") %>' 
                            Text='<%# Bind("invoice") + Request.QueryString("invoice") %>' ></asp:HyperLink>
                    </ItemTemplate>
                 </asp:TemplateField>
               <%-- <asp:BoundField HeaderText="Invoice"  DataField="invoice"  />--%>
                  <asp:BoundField HeaderText="Bill 2 Code" DataField="billtocode" />
                  <asp:BoundField HeaderText="Brand" DataField="Brand" />
                  <asp:BoundField HeaderText="Model" DataField="Model" />
                  <asp:BoundField HeaderText="Request Date" DataField="requestDate" />
                  <asp:BoundField HeaderText="Tech" DataField="Tech" />
                  <asp:BoundField HeaderText="BillCode" DataField="BillCode" />
                  <asp:BoundField HeaderText="city" DataField="city" />
                  <asp:BoundField HeaderText="Zip" DataField="Zip" />
                  <asp:BoundField HeaderText="Cat" DataField="CAT" />
                  <asp:BoundField HeaderText="Dept" DataField="Dept" />
                  <asp:BoundField HeaderText="LastName" DataField="LastName" />
                  <asp:BoundField HeaderText="PartsreceivedNotes" DataField="PartsreceivedNotes" />
                  <asp:BoundField HeaderText="MaxOfTripDate" DataField="MaxOfTripDate" />
                  <asp:BoundField HeaderText="TAT" DataField="TAT" />
                  <asp:BoundField HeaderText="jobsize" DataField="jobsize" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Bind("invoice") + Request.QueryString("invoice") %>' 
                                        Text="View"></asp:HyperLink>
                                </ItemTemplate>
                             </asp:TemplateField>
              </Columns>    
              <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
        </ContentTemplate>
       </asp:TabPanel>    
       <!-- Tab that contains Units Requiring More Information-->
        <asp:TabPanel ID="tabPanelUnitsRequireMoreInfo" runat="server" 
        HeaderText="Units Requiring More Info"
        Enabled="true"
        ScrollBars="Auto"        
        OnDemandMode="Once">
    
         <ContentTemplate>
            <asp:Repeater ID="unitsNeedingMoreInfoRepeater" runat="server">
             <HeaderTemplate>
                   <table class="tblcolor">
                    <tr bgcolor="gray" ><b>
                        <td>Invoice</td>
                        <td>Brand</td>
                        <td>Model</td>
                        <td>Research Request Date</td>
                        <td>Time in Queue</td>
                        <td>Research Tech</td>
                        <td>Assigned To Tech</td>
                        <td>Bill Code</td>
                        <td>Status</td>
                        <td>CAT</td>
                        <td>Notes</td>
                    </b>
                    </tr>
                    <tr bgcolor="gray" ><b>
                        <td>Shelf</td>
                        <td>request scheduled</td>
                        <td>last name</td>
                        <td>first name</td>
                        <td>dept</td>
                        <td>tentative trip</td>
                        <td>city</td>
                        <td>zip</td>
                        <td>bill to company</td>
                        <td>trip date</td>
                        <td>job size</td>
                    </b>
                    </tr>
             </HeaderTemplate>
             <ItemTemplate>
               <!-- Add 2 rolls of data here to help fit all columns on 1 page-->
               <tr class="tblrowcolor"  bgcolor="white">
                        <td> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "invoice", "Desc.aspx?query={0}") %>'>
                           <%# DataBinder.Eval(Container.DataItem, "invoice") %>
                           </asp:HyperLink>
                        </td>
                        <td> <%# DataBinder.Eval(Container.DataItem, "BRAND")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "model")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "REQUESTDATE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "TAT")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "RESEARCHER")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "DATEPICKEDUP")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "BILLCODE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "STATCODE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "CATEGORY")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "BillingUnitsTroubleshoot")%></td>
               </tr>
               <tr class="tblrowcolor"  bgcolor="white">
                        <td><%# DataBinder.Eval(Container.DataItem, "SHELF")%></td>
                        <td>request scheduled</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "LASTNAME")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "FIRSTNAME")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "DEPARTMENT")%></td>
                      <%--  <td><%# DataBinder.Eval(Container.DataItem, "hasTenativeTrip")%></td>--%>
                        <td>HasTenativeTrip</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "CITY")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ZipCode")%></td>
                        <%--<td><%# DataBinder.Eval(Container.DataItem, "CODE")%></td> --%>
                        <td>CODE</td>
                        <td>trip date</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "jobsize")%></td>
               </tr>
             </ItemTemplate>
             <AlternatingItemTemplate>
               <tr class="tblrowcolor"   bgcolor="aqua">
                        <td> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "invoice", "Desc.aspx?query={0}") %>'>
                           <%# DataBinder.Eval(Container.DataItem, "invoice") %>
                           </asp:HyperLink>
                        </td>
                        <td> <%# DataBinder.Eval(Container.DataItem, "BRAND")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "model")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "REQUESTDATE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "TAT")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "RESEARCHER")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "DATEPICKEDUP")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "BILLCODE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "STATCODE")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "CATEGORY")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "BillingUnitsTroubleshoot")%></td>
                        <td></td>
               </tr>
               <tr class="tblrowcolor"  bgcolor="aqua">
                        <td><%# DataBinder.Eval(Container.DataItem, "SHELF")%></td>
                        <td>request scheduled</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "LASTNAME")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "FIRSTNAME")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "DEPARTMENT")%></td>
                       <%-- <td><%# DataBinder.Eval(Container.DataItem, "hasTenativeTrip")%></td>--%>
                        <td>hasTenativeTrip</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "CITY")%></td>
                        <td><%# DataBinder.Eval(Container.DataItem, "ZipCode")%></td>
                       <%-- <td><%# DataBinder.Eval(Container.DataItem, "CODE")%></td>--%>
                       <td>CODE</td>
                        <td>trip date</td>
                        <td><%# DataBinder.Eval(Container.DataItem, "jobsize")%></td>
               </tr>
             </AlternatingItemTemplate>
             <SeparatorTemplate>
                 <tr>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            
                 </tr>
             </SeparatorTemplate>
             <FooterTemplate>
               <tr>
                    <td>
                           
                    </td>
                </tr>
               </table>
             </FooterTemplate>
            </asp:Repeater>
         </ContentTemplate>
        </asp:TabPanel>           
        <!--Tab that contains Parts Here in 7 or less days -->
        <asp:TabPanel ID="tabPanel6" runat="server" 
            HeaderText="Parts Here in 7 or less days"
            Enabled="true"
            ScrollBars="Auto"        
            OnDemandMode="Once">
            <ContentTemplate>
            <asp:Repeater ID="partsHereIn7orLessDaysRepeater" runat="server">
                <HeaderTemplate>          
                   <table class="tblcolor" border="1" cellpadding="1">
                    <tr bgcolor="gray" >
                        <b>
                            <td>
                                Invoice
                            </td>
                            <td>
                                Part
                            </td>
                            <td>
                                Desc
                            </td>
                            <td>
                               Model
                            </td>
                            <td>
                                Category
                            </td>
                            <td>
                                Department
                            </td>
                            <td>
                                Bill To
                            </td>
                            <td>
                                Expected
                            </td>
                            <td>
                                TAT
                            </td>
                            <td>
                                FirstName
                            </td>
                            <td>
                                LastName
                            </td>
                            <td>
                                Address
                            </td>
                            <td>
                                City
                            </td>
                        </b>
                    </tr>
                </HeaderTemplate>
                <ItemTemplate>                    
                    <tr class="tblrowcolor">
                        <td>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "invoice", "Desc.aspx?query={0}") %>'>
                           <%# DataBinder.Eval(Container.DataItem, "invoice") %>
                           </asp:HyperLink>
                        </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "part")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "description")%>
                            </td>
                            <td>
                                 <%# DataBinder.Eval(Container.DataItem, "model")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "category")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "department")%>
                            </td>
                            <td>
                                 <%-- <%# DataBinder.Eval(Container.DataItem, "billTo")%>--%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "expected")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "tat")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "FIRSTNAME")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "LASTNAME")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "address")%>
                            </td>
                            <td>
                                 <%# DataBinder.Eval(Container.DataItem, "City")%>
                            </td>
                    </tr>
                    <!-- possible to have another row here-->
                </ItemTemplate>
                <AlternatingItemTemplate>
                           <tr class="tblrowcolor" bgcolor="aqua">
                        <td>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "invoice", "Desc.aspx?query={0}") %>'>
                           <%# DataBinder.Eval(Container.DataItem, "invoice") %>
                           </asp:HyperLink>
                        </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "part")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "description")%>
                            </td>
                            <td>
                                 <%# DataBinder.Eval(Container.DataItem, "model")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "category")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "department")%>
                            </td>
                            <td>
                                 <%-- <%# DataBinder.Eval(Container.DataItem, "billTo")%>--%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "expected")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "tat")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "FIRSTNAME")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "LASTNAME")%>
                            </td>
                            <td>
                                  <%# DataBinder.Eval(Container.DataItem, "address")%>
                            </td>
                            <td>
                                   <%# DataBinder.Eval(Container.DataItem, "City")%>
                            </td>
                    </tr>
               
                </AlternatingItemTemplate>
                <separatortemplate>
                           <tr>
                            <td>
                                <hr />
                            </td>
                              <td>
                                  <hr />
                            </td>
                            <td>
                                  <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                  <hr />
                            </td>
                            <td>
                                  <hr />
                            </td>
                            <td>
                                 <hr />
                            </td>
                            <td>
                                 <hr />
                            </td>
                            <td>
                                <hr />
                            </td>
                            <td>
                                 <hr />
                            </td>
                            <td>
                                  <hr />
                            </td>
                            <td>
                              <hr />
                            </td>
                            <td>
                              <hr />
                            </td>
                          </tr>
                        </separatortemplate>
                <FooterTemplate>
                            <tr>
                                <td>
                           
                                </td>
                            </tr>
                        </table>
                    </FooterTemplate>
              </asp:Repeater>              
            </ContentTemplate>
        </asp:TabPanel>
      
        </asp:TabContainer>
        </td>   
      
        </tr>     
    </table>         
        <br />
   </form>
   </body>

</html>

